package util

import (
	"encoding/json"
	"log"
)

func JsonEncode(obj interface{}) string {
	bs, err := json.Marshal(obj)
	if err != nil {
		log.Printf("json marshal error, data=%+v, err=%+v", obj, err)
	}
	return string(bs)
}

func JsonDecode(str string, obj interface{}) {
	err := json.Unmarshal([]byte(str), obj)
	if err != nil {
		log.Printf("json unmarshal error, data=%+v, err=%+v", obj, err)
	}
}
